<template>
    <div class="login-container">
      <el-card class="login-box">
        <h2>后台管理系统</h2>
        <el-form :model="form" label-width="80px">
          <el-form-item label="用户名">
            <el-input v-model="form.username" />
          </el-form-item>
          <el-form-item label="密码">
            <el-input v-model="form.password" type="password" />
          </el-form-item>
          <el-button type="primary" @click="handleLogin">登录</el-button>
        </el-form>
      </el-card>
    </div>
  </template>
  
  <script setup>
  import { reactive } from 'vue'
  import { useRouter } from 'vue-router'
  
  const form = reactive({
    username: '',
    password: ''
  })
  
  const router = useRouter()
  
  const handleLogin = () => {
    localStorage.setItem('token', 'demo-token')
    router.push('/')
  }
  </script>
  
  <style scoped>
  .login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: #f0f2f5;
  }
  
  .login-box {
    width: 400px;
    padding: 20px;
    box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
  }
  
  h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #409eff;
  }
  </style>